// JavaScript Document
// Last updated 2006-02-21
function addRowToTable(table_id)
{
  var tbl = document.getElementById(table_id);
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var lastRowText = lastRow+1;
  var iteration = 'Player ' + lastRowText;
  var row = tbl.insertRow(lastRow);
 
 // left cell
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode(iteration);
  cellLeft.appendChild(textNode);

  // left cell
  var cellRight = row.insertCell(1);
  var el = document.createElement('textarea');
  if(table_id == 'tblTeam')
	  el.name = 'txtPlayer[]';
  else
  	  el.name = 'txtPlayer2[]';
	  
  el.id = 'txtRow' + iteration;
  el.cols = 45;
  el.rows = 5;
  cellRight.appendChild(el);
}



function removeRowFromTable(table_id)
{
  var tbl = document.getElementById(table_id);
  var lastRow = tbl.rows.length;
  if (lastRow > 1) tbl.deleteRow(lastRow - 1);
}


